import axios from 'axios'
import NProgress from 'nprogress' // 进度条
import 'nprogress/nprogress.css' //样式必须引入

const install = axios.create({
    baseURL: '/mock',
    timeout: 5000
})

install.interceptors.request.use(config => {
    NProgress.start()
    return config
}, error => {
    return Promise.reject(error)
})

install.interceptors.response.use(config => {
    NProgress.done()
    return config.data
}, error => {
    return Promise.reject(error)
})

export default install